<template>
  <div id="app">
    <div 
      class="container"
      :class="{'is-show-header': showHeader, 'is-show-footer': showFooter}">
      <app-bar v-show="showHeader">
        <go-back v-show="showBack" slot="left"/>
        {{title}}
      </app-bar>
      <router-view/>
      <tab-bar v-show="showFooter"></tab-bar>
    </div>
  </div>
</template>
<script>
import AppBar from './components/app-bar/app-bar'
import TabBar from './components/tab-bar/tab-bar'
import GoBack from './components/go-back/go-back'
export default {
  components: { GoBack, AppBar, TabBar },
  computed: {
    showFooter () {
      return this.$route.meta.showFooter
    },
    showHeader () {
      return this.$route.meta.showHeader
    },
    showBack () {
      return this.$route.meta.showBack
    },
    title () {
      return this.$route.meta.title
    }
  },
  mounted() {
    this.$http.get('user/index'),function(res){
      console.log(res)
    }
    this.$http.post('user/userDel'),function(res){
      console.log(res)
    }
  }
}
</script>
<style lang="scss">
@import "@/style/index.scss";

*{
  margin: 0;
  padding: 0;
  list-style: none;
}

#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  font-size: 14px;
  color: #2c3e50;
}

#nav {
  padding: 30px;

  a {
    font-weight: bold;
    color: #2c3e50;

    &.router-link-exact-active {
      color: #42b983;
    }
  }
}
.container{
  min-height: 100vh;
  &.is-show-header{
    min-height: calc(100vh - 45px);
    padding-top: 45px;
    &.is-show-footer{
      min-height: calc(100vh - 95px);
    }
  }
  &.is-show-footer{
    min-height: calc(100vh - 50px);
    padding-bottom: 50px;
  }
}
</style>
